<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<html lang="en-us">

<head>
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Cmake Task</title>
</head>

<body>

<h2><a name="javac">Cmake</a></h2>
<h3>Description</h3>
<p>Generates a <a href="http://cmake.org/">cmake</a> build, and runs the
configured build tool.</p>
<p>This task is used to integrate cmake based projects with a larger ant
build.</p>

<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
  <tr>
    <td valign="top"><b>Attribute</b></td>
    <td valign="top"><b>Description</b></td>
    <td align="center" valign="top"><b>Required</b></td>
  </tr>
  <tr>
    <td valign="top">srcdir</td>
    <td valign="top">Location of the source directory, where the top level
      <code>CMakeLists.txt</code> file is found.</td>
    <td align="center" valign="top">No, defaults to the current directory.</td>
  </tr>
  <tr>
    <td valign="top">bindir</td>
    <td valign="top">Location to the binary directory, where the cmake output is
      written, this can be the same as the srcdir.</td>
    <td align="center" valign="top">No, defaults to the current directory</td>
  </tr>
  <tr>
    <td valign="top">buildtype</td>
    <td valign="top">The type of the build, (usually one of Debug, Release, 
      RelWithDebInfo or MinSizeRelComma).  See notes on 
      <a href="buildtype">build type</a>.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">cleanfirst</td>
    <td valign="top">Call the clean target first when building.</td>
    <td valign="top" align="center">No, defaults to false</td>
  </tr>
  <tr>
    <td valign="top">cmakeonly</td>
    <td valign="top">When set to true, runs cmake but does not execute the build.</td>
    <td align="center" valign="top">No, defaults to false</td>
  </tr>
  <tr>
    <td valign="top">target</td>
    <td valign="top">The target of the project to build.</td>
    <td align="center" valign="top">No, defaults to the generated all target</td>
  </tr>
</table>

<h3>Parameters specified as nested elements</h3>

<h4><code>generator</code></h4>
<p>Specify the cmake generator to use for each platform.  Child of <code>
cmake</code>.</p>

<table border="1" cellpadding="2" cellspacing="0">
  <tr>
    <td valign="top"><b>Attribute</b></td>
    <td valign="top"><b>Description</b></td>
    <td align="center" valign="top"><b>Required</b></td>
  </tr>
  <tr>
    <td valign="top">bindir</td>
    <td valign="top">Location to the binary directory, where the cmake output
      is written, this can be the same as the srcdir.</td>
    <td align="center" valign="top">No, defaults to the top level bindir</td>
  </tr>
  <tr>
    <td valign="top">buildtype</td>
    <td valign="top">The type of the build, (usually one of Debug, Release, 
      RelWithDebInfo or MinSizeRelComma).  See notes on 
      <a href="buildtype">build type</a>.</td>
    <td valign="top" align="center">No, defaults to the top level buildtype</td>
  </tr>
  <tr>
    <td valign="top">cleanfirst</td>
    <td valign="top">Call the clean target first when building.</td>
    <td valign="top" align="center">No, defaults to the top level cleanfirst</td>
  </tr>
  <tr>
    <td valign="top">name</td>
    <td valign="top">The name of the generator to use, this must be a valid cmake
      generator.</td>
    <td align="center" valign="top">No, defaults cmake platforms default</td>
  </tr>
  <tr>
    <td valign="top">platform</td>
    <td valign="top">The name of the platform this generator is valid for.
      This is tested against the java property <code>os.name</code>.</td>
    <td align="center" valign="top">No, defaults to support all platforms</td>
  </tr>
  <tr>
    <td valign="top">target</td>
    <td valign="top">The target of the project to build.</td>
    <td align="center" valign="top">No, defaults to the generated all target</td>
  </tr>
</table>

<h4><code>variable</code></h4>
<p>Set cmake variables.  This can be a child of the <code>cmake</code>then
it is global, or a child of the <code>generator</code> then it is specific
to that generator.</p>

<table border="1" cellpadding="2" cellspacing="0">
  <tr>
    <td valign="top"><b>Attribute</b></td>
    <td valign="top"><b>Description</b></td>
    <td align="center" valign="top"><b>Required</b></td>
  </tr>
  <tr>
    <td valign="top">name</td>
    <td valign="top">The name of the variable to set.</td>
    <td align="center" valign="top">Yes</td>
  </tr>
  <tr>
    <td valign="top">type</td>
    <td valign="top">The type of the variable. Possible values STRING,
      FILEPATH, PATH, BOOL.</td>
    <td valign="top" align="center">No, defaults to STRING</td>
  </tr>
  <tr>
    <td valign="top">value</td>
    <td valign="top">The value to set the variable.</td>
    <td align="center" valign="top">Yes</td>
  </tr>
  <tr>
    <td valign="top">target</td>
    <td valign="top">The target of the project to build.</td>
    <td align="center" valign="top">No, defaults to the top level target</td>
  </tr>
</table>

<h4><code>readvar</code></h4>
<p>Read the value of a cmake cache variable to an ant varaiable. Child of
<code>cmake</code></p>

<table border="1" cellpadding="2" cellspacing="0">
  <tr>
    <td valign="top"><b>Attribute</b></td>
    <td valign="top"><b>Description</b></td>
    <td align="center" valign="top"><b>Required</b></td>
  </tr>
  <tr>
    <td valign="top">name</td>
    <td valign="top">The name of the variable to read.</td>
    <td align="center" valign="top">Yes</td>
  </tr>
  <tr>
    <td valign="top">property</td>
    <td valign="top">The name of the ant property to set.</td>
    <td align="center" valign="top">Yes</td>
  </tr>
</table>

<h3>Examples</h3>
<pre>  &lt;taskdef name=&quot;cmake&quot;
    classname=&quot;org.iainhull.ant.CmakeBuilder&quot;/&gt;

  &lt;cmake/&gt;</pre>
<p>Run cmake in the current directory, using it both the source directory
and binary directory, then executes the resulting make files or projects.</p>

<pre>  &lt;taskdef name=&quot;cmake&quot;
    classname=&quot;org.iainhull.ant.CmakeBuilder&quot;/&gt;

  &lt;cmake srcdir=&quot;${src}&quot;
    bindir=&quot;${binary}&quot;
    buildtype=&quot;${buildtype}&quot; /&gt;</pre>
<p>Runs cmake in the ${src} directory and write the output to the ${binary}
directory, then executes the resulting make files or projects.</p>

<pre>  &lt;taskdef name=&quot;cmake&quot;
    classname=&quot;org.iainhull.ant.CmakeBuilder&quot;/&gt;

  &lt;cmake srcdir=&quot;${src}&quot;
      bindir=&quot;${binary}&quot;
      buildtype=&quot;${buildtype}&quot; &gt;
        &lt;generator name=&quot;Visual Studio 8 2005&quot; platform="windows" /&gt;
        &lt;generator name=&quot;Unix Makefiles&quot; /&gt;
  &lt;/cmake&gt;</pre>
<p>Runs cmake in the ${src} directory and write the output to the ${binary}
directory, then executes the resulting make files or projects.  On the &quot;
windows&quot; platform the &quot;Visual Studio 8 2005&quot; on all other
plaforms the default generator is used.</p>

<h3><a name="buildtype" />Build Type Notes</h3>

<p>The buildtype attribute of the cmake and generator tags is used to set the
cmake variable CMAKE_BUILD_TYPE.  This is usually one of Debug, Release, 
RelWithDebInfo or MinSizeRelComma see the Cmake documentation for
the CMAKE_BUILD_TYPE and CMAKE_CONFIGURATION_TYPES for more information.</p>
</body>
</html>
